package com.api.shopapi.service.impl;


import com.api.shopapi.entity.PracticeSite;
import com.api.shopapi.entity.VolunteerTeam;
import com.api.shopapi.mapper.PracticeSiteMapper;
import com.api.shopapi.service.PracticeSiteService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.tomcat.jni.Proc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("PracticeSiteServiceImplOne")
public class PracticeSiteServiceImpl implements PracticeSiteService {

    @Autowired
    private PracticeSiteMapper practiceSiteMapper;

    @Override
    public
    int insert(PracticeSite practiceSite){
        return practiceSiteMapper.insert(practiceSite);
    }


    @Override
    public
    int delete(String practiceSiteCode){
        return practiceSiteMapper.delete(practiceSiteCode);
    }


    @Override
    public
    int update(PracticeSite practiceSite){
        return practiceSiteMapper.update(practiceSite);
    }

    @Override
    public
    PracticeSite getByPracticeSiteCode( String practiceSiteCode){
        return practiceSiteMapper.getByPracticeSiteCode(practiceSiteCode);
    }

    @Override
    public
    PracticeSite getByUserCode( String userCode){
        return practiceSiteMapper.getByUserCode(userCode);
    }



    @Override
    public PageInfo<PracticeSite> pageByCommandCenterCode(int pageIndex, int pageSize, String commandCenterCode, int applyStatus){
        PageHelper.startPage(pageIndex,pageSize);
        List<PracticeSite> list = practiceSiteMapper.listByCommandCenterCode(commandCenterCode,applyStatus);
        return new PageInfo<>(list);
    }


    @Override
    public
    PageInfo<PracticeSite> pageByCommandCenterCodeApply(int pageIndex, int pageSize, String commandCenterCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<PracticeSite> list = practiceSiteMapper.listByCommandCenterCodeApply(commandCenterCode);
        return new PageInfo<>(list);
    }


    /**
     * 所有的志愿队伍
     * */

    @Override
    public
    PageInfo<PracticeSite> pageByGovCode(int pageIndex, int pageSize, String governmentCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<PracticeSite> list = practiceSiteMapper.listByGovCode(governmentCode);
        return new PageInfo<>(list);
    }



}
